const { list } = require('./mock')


module.exports = app => {

	app.get('/api/list', (req, res) => {
		const { _page = 1, _size = 10 } = req.query;

		if (_page * _size - _size < list.length) {
			res.send({
				code: 200,
				data: list.slice((_page - 1) * _size, _page * _size)
			})
		} else {
			res.send({
				code: 400
			})
		}
	})


}